package com.mioto.ld.module.statistics;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.mioto.ld.module.statistics.model.SearchConditionDTO;


/**
 * @author mioto-qinxj
 * @date 2024/6/16
 * @desc
 */
public class CustomStatistics extends AbstractStatistics {


    @Override
    protected void calSearchDate(SearchConditionDTO searchDTO) {

        long betweenDay = DateUtil.between(searchDTO.getStartTime(),searchDTO.getEndTime(),  DateUnit.DAY);
        index = (int)betweenDay;
        searchDTO.setSameCompareStartDate(DateUtil.offsetDay(searchDTO.getStartTime(),  -index));
        searchDTO.setSameCompareEndDate(DateUtil.offsetSecond(searchDTO.getStartTime(),-1));
    }

}
